<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="../../res/layui/css/layui.css" media="all">
    <script src="../../res/js/jquery-3.4.1.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../res/layui/layui.js" charset="utf-8"></script>
    <script src="../../res/js/Tools.js" type="text/javascript"></script>
</head>
<style type="text/css">
    table {
        margin-top: 10px;
        font: 14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial, sans-serif;
        color: #666666;
        width: 100%;
    }

    td {
        padding: 0 15px;
        position: relative;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        box-sizing: border-box;
    }

    tr {
        height: 35px;
    }

    .head {

        background: #F2F2F2;
        width: 25%;
    }

    .itemhead, .itembody {
        font: 14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial, sans-serif;
        color: #000;
    }

    .fujian, .fujian td {
        border-color: #fff;
    }

    .body {
        width: 25%;
    }
</style>
<body>
<button class="layui-btn layui-icon layui-icon-file" id="export" lay-event="export"  data-type="reload">导出Word</button>
<table border="1" id="tab" bordercolor="#E6E6E6" cellspacing="0">

</table>
<script type="text/javascript">

    /**
     * 数据库日期转化为 2019-10-29 12:00:00格式
     * @param value
     * @returns {string}
     */
    function dateTime(value) {
        var da = new Date(value.replace("/Date(", "").replace(")/", "").split("+")[0]);
        return da.getFullYear() + "-" + ((da.getMonth() + 1) < 10 ? "0" + (da.getMonth() + 1) : (da.getMonth() + 1)) + "-" + (da.getDate() < 10 ? "0" + da.getDate() : da.getDate()) + " " + (da.getHours() < 10 ? "0" + da.getHours() : da.getHours()) + ":" + (da.getMinutes() < 10 ? "0" + da.getMinutes() : da.getMinutes()) + ":" + (da.getSeconds() < 10 ? "0" + da.getSeconds() : da.getSeconds());
    }

    /**
     * 数据库日期转化为 2019-10-29格式
     * @param value
     * @returns {string}
     */
    function date(value) {
        var da = new Date(value.replace("/Date(", "").replace(")/", "").split("+")[0]);
        return da.getFullYear() + "-" + ((da.getMonth() + 1) < 10 ? "0" + (da.getMonth() + 1) : (da.getMonth() + 1)) + "-" + (da.getDate() < 10 ? "0" + da.getDate() : da.getDate());
    }

    $(function () {
        var id = getQueryString("curriculumId");
        var url = "../../../atsPlanCurriculumController/findById";
        var data = {curriculumId: id, pid: id}
        var body = null;
        $.post(url, data, function (obj) {

            body = '<tr>' +
                '<td class="head">计划名称</td>' +
                '<td class="body">' + obj.data.curriculumName + '</td>' +
                '<td class="head">运动项目名称</td>' +
                '<td class="body">' + obj.data.itemName + '</td>' +
                '</tr><tr>' +
                '<td class="head">教练员姓名</td>' +
                '<td class="body">' + obj.data.coachName + '</td>' +
                '<td class="head">其他教练员</td>' +
                '<td class="body">' + obj.data.otherCoach + '</td>' +
                '</tr><tr>' +
                '<td class="head">制定时间</td>' +
                '<td class="body">' + obj.data.planDate + '</td>' +
                '<td class="head">周日计划名称</td>' +
                '<td class="body">' + obj.data.weekName + '</td>' +
                '</tr><tr>' +
                '<td class="head">应到人数</td>' +
                '<td class="body">' + obj.data.weekShould + '</td>' +
                '<td class="head">实到人数</td>' +
                '<td class="body">' + obj.data.weekReality + '</td>' +
                '</tr><tr>' +
                '<td class="head">训练配对</td>' +
                '<td class="body">' + obj.data.weekPair + '</td>' +
                '<td class="head">训练课任务</td>' +
                '<td class="body">' + obj.data.weekTask + '</td>' +
                '</tr><tr>' +
                '<td class="head">训练课人数</td>' +
                '<td class="body">' + obj.data.weekQuantity + '</td>' +
                '<td class="head">准备部分</td>' +
                '<td class="body">' + obj.data.weekSetout + '</td>' +
                '</tr><tr>' +
                '<td class="head">基本部分</td>' +
                '<td class="body">' + obj.data.weekBasic + '</td>' +
                '<td class="head">结束部分</td>' +
                '<td class="body">' + obj.data.weekEnd + '</td>' +
                '</tr>';
            body += '<tr class="fujian"><td colspan="4"></td>';
            $.each(obj.list, function (index, item) {
                body += '</tr><tr><td class="itemhead head">指标名称</td><td  class="itembody body">' + item.itemName + '</td><td class="itemhead head">指标值</td><td  class="itembody body">' + item.itemValue + '</td></tr>';
            });


            $("#tab").append(body);
        }, "json")
    });
</script>
</body>


</html>